import React, { Component } from 'react';
import {LoadingOutlined} from '@ant-design/icons';
import "@/components/Loading/index.css"
const withLoading = (WrappedComponent) => {
  return class WithLoading extends Component {
    constructor(props) {
      super(props);
      this.state = {
        isLoading: false
      };
    }

    setLoading = (isLoading) => {
      this.setState({ isLoading });
    };

    render() {
      const { isLoading } = this.state;
      return (
        <div>
          {/* {isLoading &&  <div className="loading-overlay">Loading...<LoadingOutlined /></div>} */}
          {isLoading &&  React.createElement('div', {className: 'loading-overlay' },"Loading...",React.createElement(LoadingOutlined))}
          <WrappedComponent setLoading={this.setLoading} {...this.props} />
        </div>
      );
    }
  };
};

export default withLoading;
